package com.axjy.myspringdata.dao;

import com.axjy.myspringdata.pojo.Emp;
import org.hibernate.cfg.JPAIndexHolder;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.Repository;

import java.util.List;


public interface EmpDao extends JpaRepository<Emp,Integer>{

    public List<Emp> findEmpsByEnameContains(String ename);

    @Query(value="select * from emp   where ename like ?1",
    countQuery = "select count(*) from emp where ename like ?1",
    nativeQuery = true)
    public Page<Emp> findByEname(String ename, Pageable pageable);

}
